package view;

import controller.Controller;
import memory.spel.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;

public class HoofdmenuView extends Activity {
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.hoofdmenu);
		// eerste keer aanroepen controller om de context mee te geven
		Controller.getInstance(this);
	}

	public void handleAction(View view) {
		Intent intent = null;
		switch (view.getId()) {
		case R.id.startSpel:
			intent = new Intent(this, SpelbordView.class);
			startActivity(intent);
			break;
		}
	}

	//*****************************************************
	//Opties menu
	//
	//*****************************************************
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.menu, menu);
		menu.getItem(0).setVisible(false);
		menu.getItem(1).setVisible(false);
		return true;
	}

	public boolean onOptionsItemSelected(MenuItem item) {
		Intent intent = null;
		switch (item.getItemId()) {
		case R.id.instellingen:
			intent = new Intent(this, Preferences.class);
			startActivity(intent);
			break;
		case R.id.help:
			intent = new Intent(this, Help.class);
			break;
		}
		startActivity(intent);
		return true;
	}
}
